from django.conf.urls.defaults import *

# first rule matches first
urlpatterns = patterns('',
    (r'^$', 'looptube.controllers.IndexController.indexAction'),
    (r'^topvideos/?$', 'looptube.controllers.IndexController.videoListAction', {'type' : 'top'}),
    (r'^topvideos/(?P<page>\d+)/?$', 'looptube.controllers.IndexController.videoListAction', {'type' : 'top'}),
    (r'^recentvideos/?$', 'looptube.controllers.IndexController.videoListAction', {'type' : 'recent'}),
    (r'^recentvideos/(?P<page>\d+)/?$', 'looptube.controllers.IndexController.videoListAction', {'type' : 'recent'}),
    (r'^channel/?$', 'looptube.controllers.ChannelController.indexAction'),
    (r'^channel/recent/(?P<channelName>[^/]*)/?$', 'looptube.controllers.IndexController.videoListAction', {'type' : 'channel'}),
    (r'^channel/recent/(?P<channelName>[^/]*)/(?P<page>\d+)/?$', 'looptube.controllers.IndexController.videoListAction', {'type' : 'channel'}),
    (r'^channel/play/(?P<channel>[^/]*)/?$', 'looptube.controllers.ChannelController.playAction'),
    (r'^channel/play/highlight/?$', 'looptube.controllers.ChannelController.playAction', {'channel' : 'highlight'}),
    (r'^channel/playlist/(?P<videoIDs>[^/]*)/?$', 'looptube.controllers.ChannelController.playAction', {'channel' : 'playlist'}),
    (r'^channel/splaylist/add/?$', 'looptube.controllers.ChannelController.addPlaylistAction'),
    (r'^channel/splaylist/(?P<key>[^/]*)/?$', 'looptube.controllers.ChannelController.playAction', {'channel' : 'playlist'}),
    (r'^playlist/add/?$', 'looptube.controllers.ChannelController.addPlaylistAction'),
    (r'^playlist/create/?$', 'looptube.controllers.ChannelController.createPlaylistAction'),
    (r'^playlist/edit/(?P<key>[^/]*)/?$', 'looptube.controllers.ChannelController.editPlaylistAction'),
    (r'^playlist/edit/highlight/?$', 'looptube.controllers.ChannelController.editPlaylistAction', {'key' : 'highlight'}),
    (r'^playlist/user/(?P<useremail>[^/]*)/?$', 'looptube.controllers.ChannelController.getUserPlaylistAction'),
    (r'^playlist/(?P<key>[^/]*)/?$', 'looptube.controllers.ChannelController.playAction', {'channel' : 'playlist'}),
    (r'^channel/fetch/similarsongs/?$', 'looptube.controllers.ChannelController.getSimilarSongsAction'),
    (r'^channel/fetch/similarartists/?$', 'looptube.controllers.ChannelController.getSimilarArtistsAction'),
    (r'^channel/fetch/artisttrack/?$', 'looptube.controllers.ChannelController.getArtistTrackAction'),
    (r'^channel/fetch/youtuberesult/?$', 'looptube.controllers.ChannelController.getYouTubeResultAction'),    
    (r'^channel/fetch/?$', 'looptube.controllers.ChannelController.fetchAction'),
    (r'^loop/error/(?P<videoID>[^/]*)/?$', 'looptube.controllers.LoopController.errorAction'),
    (r'^loop/login/(?P<movieID>[^/]*)/?$', 'looptube.controllers.LoopController.loopAction', {'forceLogin' : True}),
    (r'^loop/login/(?P<source>[^/]*)/(?P<movieID>[^/]*)/?$', 'looptube.controllers.LoopController.loopAction', {'forceLogin' : True}),    
    (r'^loop/ns/(?P<movieID>[^/]*)/?$', 'looptube.controllers.LoopController.loopAction', {'noshare' : True}),
    (r'^loop/ns/(?P<source>[^/]*)/(?P<movieID>[^/]*)/?$', 'looptube.controllers.LoopController.loopAction', {'noshare' : True}),    
    (r'^loop/(?P<movieID>[^/]*)/?$', 'looptube.controllers.LoopController.loopAction'),
    (r'^loop/(?P<source>[^/]*)/(?P<movieID>[^/]*)/?$', 'looptube.controllers.LoopController.loopAction'),    
    (r'^widget/playlist/add/(?P<key>[^/]*)/?$', 'looptube.controllers.WidgetController.addPlaylistWidgetAction'),
    (r'^widget/playlist/(?P<key>[^/]*)/?$', 'looptube.controllers.WidgetController.playlistAction'),
    (r'^widget/wideplaylist/(?P<key>[^/]*)/?$', 'looptube.controllers.WidgetController.playlistAction', {'widgetType' : 'wide'}),
    (r'^widget/urlv/add/?$', 'looptube.controllers.WidgetController.addUserRecentLoopedVideosAction'),
    (r'^widget/urlv/?$', 'looptube.controllers.WidgetController.userRecentLoopedVideosAction'),
    (r'^widget/highlight/?$', 'looptube.controllers.WidgetController.highlightVideosAction'),
    (r'^search/?$', 'looptube.controllers.SearchController.indexAction'),
    (r'^search/related/?$', 'looptube.controllers.SearchController.relatedVideosAction'),
    (r'^search/similar/?$', 'looptube.controllers.SearchController.similarVideosAction'),
    (r'^cron/run/?$', 'looptube.controllers.CronController.runAction'),
    (r'^cron/tempjob/?$', 'looptube.controllers.CronController.tempJobAction'),
)
